<include file="Public:header" />
<div class="container">
	
	<div class="page-header">
		<h4>{:L('FINANCE')}<small> - <a href="{:U('finance/index','t=receivables')}">{:L('RECEIVABLES')}</a> | 
		<a class="active" href="{:U('finance/index','t=payables')}">{:L('PAYABLES')}</a> | 
		<a href="{:U('finance/index','t=receivingorder')}">{:L('RECEIVINGORDER')}</a> | 
		<a href="{:U('finance/index','t=paymentorder')}">{:L('PAYMENTORDER')}</a> | <a href="{:U('finance/analytics')}">{:L('STATISTICS')}</a></small> </h4>
	</div>
	<include file="Public:alert" />	
	<p class="view">
		<if condition="$info['is_deleted'] eq 0">
		<a href="{:U('finance/edit','t=payables&id='.$info['payables_id'])}">{:L('EDIT')}</a> |  
		<a href="{:U('finance/delete','t=payables&id='.$info['payables_id'])}" class="del_confirm">{:L('DELETE')}</a> |  
		</if>
		<a href="javascript:void(0);" onclick="javascript:history.go(-1)" >{:L('RETURN')}</a>
	</p>
	<div class="row">
		<div class="span12">
			<table class="table table-hover">
				<tbody>
					<tr>
						<th <if condition="C('ismobile') neq 1">colspan="4"<else />colspan="2"</if>>{:L('PAYABLES DETAILS')}</th>
					</tr>
					<tr>
						<td class="tdleft" width="15%"><b>{:L('PAYABLES NAME')}</b>:</td>
						<td width="35%">{$info.name}</td>
						<if condition="C('ismobile') eq 1"></tr><tr></if>
						<td class="tdleft" width="15%"><b>{:L('CUSTOMER')}</b>:</td>
						<td width="35%">{$info['customer_name']}</td>
					</tr>
					<tr>
						<td class="tdleft"><b>{:L('CONTRACT NUMBER')}</b>:</td>
						<td>{$info['contract_name']}</td>
						<if condition="C('ismobile') eq 1"></tr><tr></if>
						<td class="tdleft"><b>{:L('PAYMENT TIME')}</b>:</td>
						<td>{$info['pay_time']|date="Y-m-d",###}</td>
					</tr>
					<tr>
						<td class="tdleft"><b>{:L('PAYMENTS')}</b>:</td>
						<td>{$info['price']}</td>
						<if condition="C('ismobile') eq 1"></tr><tr></if>
						<td class="tdleft"><b>{:L('OWNER_ROLE')}</b>:</td>
						<td><a class="role_info" rel="{$info['owner_role_id']}" href="javascript:void(0)">{$info['owner']['user_name']}</a></td>
					</tr>
					<tr>
						<td class="tdleft"><b>{:L('CREATOR_ROLE')}</b>:</td>
						<td><a class="role_info" rel="{$info['creator_role_id']}" href="javascript:void(0)">{$info['creator_name']}</a></td>
						<if condition="C('ismobile') eq 1"></tr><tr></if>
						<td class="tdleft"><b>{:L('CREATE_TIME')}</b>:</td>
						<td>{$info['create_time']|date="Y-m-d",###}</td>
					</tr>
					<tr>
						<td class="tdleft"><b>{:L('DESCRIPTION')}</b>:</td>
						<td <if condition="C('ismobile') neq 1">colspan="3"</if>><if condition="$info.description neq null"><pre>{$info.description}</pre></if></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="span12">
			<h4>{:L('PAYMENT HISTORY')} <small> - {:L('PAYMENT HISTORY DETAILS',array(count($info['paymentorder']),$info['num'],$info['num_unCheckOut'],$info['num_unPayment']))}<a id="paymentorder" class="btn btn-mini btn-primary" href="javascript:void(0);">{:L('ADD')}</a></small></h4>
			<table class="table table-hover"> 
				<if condition="$info['paymentorder'] eq null"><tr><td>{:L('EMPTY_TPL_DATA')}</td></tr><else />
				<thead>
					<tr>
						<th>{:L('PAYMENTS SINGLE NUMBER')}</th>
						<th>{:L('PAYMENTS')}</th>
						<if condition="C('ismobile') neq 1"><th>{:L('OWNER_ROLE')}</th>
						<th>{:L('PAYMENT TIME')}</th></if>
						<th>{:L('STATUS')}</th>
						<if condition="C('ismobile') neq 1"><th>{:L('OPERATING')}</th></if>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<td colspan="6">
							{$page}
						</td>
					</tr>
				</tfoot> 
				<tbody>
					<volist name="info['paymentorder']" id="vo">
						<tr>
							<td>
								<a href="{:U('finance/view','t=paymentorder&id='.$vo['paymentorder_id'])}">{$vo.name}</a>
							</td>
							<td>{:L('YUAN',array($vo['money']))}</td>
							<if condition="C('ismobile') neq 1"><td><a class="role_info" rel="{$vo['owner_role_id']}" href="javascript:void(0)">{$vo['owner']['user_name']}</a></td>
							<td><if condition="$vo.pay_time gt 0">{$vo['pay_time']|date="Y-m-d",###}</if></td></if>
							<td><if condition="$vo['status'] eq 1">{:L('HAS CLOSING')}<else />{:L('NOT CLOSING')}</if></td>
							<if condition="C('ismobile') neq 1"><td>
								<a href="{:U('finance/view','t=paymentorder&id='.$vo['paymentorder_id'])}" >{:L('VIEW')}</a>&nbsp; 
								<a href="{:U('finance/edit','t=paymentorder&id='.$vo['paymentorder_id'])}" >{:L('EDIT')}</a>&nbsp;<a href="{:U('finance/delete','t=paymentorder&id='.$vo['paymentorder_id'].'&refer=payables')}" class="del_confirm">{:L('DELETE')}</a>
							</td></if>
						</tr>
					</volist>
				</tbody>
			</table>
			</if>
		</div>
	</div>
</div>
<div class="hide" id="dialog-role-info" title="{:L('DIALOG_USER_INFO')}">loading...</div>
<div class="hide" id="dialog-paymentorder" title="{:L('ADD PAYMENTORDER')}">loading...</div>
<script type="text/javascript">
<if condition="C('ismobile') eq 1">width=$('.container').width() * 0.9;<else />width=800;</if>
	$("#dialog-role-info").dialog({
		autoOpen: false,
		modal: true,
		width: width,
		maxHeight: 600,
		position: ["center",100]
	});
	$("#dialog-paymentorder").dialog({
		autoOpen: false,
		modal: true,
		width: width,
		maxHeight: 600,
		position: ["center",100]
	});
	$(function(){
		$(".role_info").click(function(){
			$role_id = $(this).attr('rel');
			$('#dialog-role-info').dialog('open');
			$('#dialog-role-info').load('{:U("user/dialoginfo","id=")}'+$role_id);
		});
		$("#paymentorder").click(function(){
			$('#dialog-paymentorder').dialog('open');
			$('#dialog-paymentorder').load('{:U("finance/adddialog","t=paymentorder&id=")}'+{$info['payables_id']});
		});
	});
</script>
<include file="Public:footer" />